$(function(){
	if(_isAli){
		IMPlayer.CheckConnection ();
		IMPlayer.UpdateStatusSignal.connect(OnStateChanged);
	}
	window.addEventListener("pagehide", pageHide, false);
	
	var url = "";					//获取播放地址
	play(url);
})

function pageHide(){
	IMPlayer.Stop();
}

function play(url){
	try {	
		IMPlayer.Play(playUrl,data.mode);
	}catch (e) {
        $.log(e);
	}
}


function OnStateChanged(state, percent,speed){ 
	myPlayer.state = state;  
	if ("play" == state) {
		
		hideBackground(); 
		isInitBuffer = false;
	}else if("buffer" == state){
		
	}
}


var hasHideBackground = false;
function hideBackground(){
	if(!hasHideBackground){
		
		$('#pagewrap').attr("style","background: url();").hide();
		hasHideBackground = true;
	}
}